package com.example.demo2.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

import androidx.annotation.Nullable;

import com.example.demo2.IHelloService;

public class RemoteService extends Service {

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        // Return the interface
        return binder;
    }

    private final IHelloService.Stub binder = new IHelloService.Stub() {
        @Override
        public String sayHello(String name) throws RemoteException {
            return String.format("Hello %s", name);
        }
    };
}
